﻿using System.Windows;
using System.Windows.Media;

namespace LpbPrj.Client.Controls;

/// <summary>
/// UI编辑器功能用的扩展属性
/// </summary>
public class PropertyEditingAttach
{
    /// <summary>
    /// 正在编辑
    /// </summary>
    public static readonly DependencyProperty EditingStatusProperty = DependencyProperty.RegisterAttached(
        "EditingStatus", typeof(bool), typeof(PropertyEditingAttach), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.Inherits));
    public static void SetEditingStatus(DependencyObject element, bool value) => element.SetValue(EditingStatusProperty, value);
    public static bool GetEditingStatus(DependencyObject element) => (bool)element.GetValue(EditingStatusProperty);

    /// <summary>
    /// 正在编辑时对应的边框大小
    /// </summary>
    public static readonly DependencyProperty EditingThicknessProperty = DependencyProperty.RegisterAttached(
        "EditingThickness", typeof(Thickness), typeof(PropertyEditingAttach), new FrameworkPropertyMetadata(new Thickness(5, 5, 5, 5), FrameworkPropertyMetadataOptions.Inherits));
    public static void SetEditingThickness(DependencyObject element, Thickness value) => element.SetValue(EditingThicknessProperty, value);
    public static Thickness GetEditingThickness(DependencyObject element) => (Thickness)element.GetValue(EditingThicknessProperty);

    /// <summary>
    /// 正在编辑时对应的边框颜色
    /// </summary>
    public static readonly DependencyProperty EditingBorderBrushProperty = DependencyProperty.RegisterAttached(
        "EditingBorderBrush", typeof(Brush), typeof(PropertyEditingAttach), new FrameworkPropertyMetadata(Brushes.Red, FrameworkPropertyMetadataOptions.Inherits));
    public static void SetEditingBorderBrush(DependencyObject element, Brush value) => element.SetValue(EditingBorderBrushProperty, value);
    public static Brush GetEditingBorderBrush(DependencyObject element) => (Brush)element.GetValue(EditingBorderBrushProperty);


}